#!/usr/bin/env python
# -*- coding: UTF-8 -*-

[查询卖家地址库]
route_key:shopex_b2b_store.logistics.address.search_taobao

python run.py -f store_logistics_address_search_to_sdf
python run.py -f taobao_logistics_address_search_to_taobao
python run.py -f res_taobao_logistics_address_search_to_sdf
python run.py -f res_store_logistics_address_search_to_b2b

ps -ef|grep logistics_address|grep python
ps -ef|grep logistics_address|grep python|awk '{print $2}'|xargs kill -9

route_step = {
  "_id": "shopex_b2b_store.logistics.address.search_taobao",
  "list": [
    {
      "vhost": "shopex_b2b",
      "key": "store_logistics_address_search_to_sdf"
    },
    {
      "vhost": "taobao",
      "key": "taobao_logistics_address_search_to_taobao"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_logistics_address_search_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_logistics_address_search_to_b2b"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

--------------------------------------------------------------------------------------------------------

[自己联系物流（线下物流）发货]
route_key:shopex_b2b_store.logistics.offline.send_taobao

python run.py -f store_logistics_offline_send_to_sdf
python run.py -f taobao_logistics_offline_send_to_taobao
python run.py -f res_taobao_logistics_offline_send_to_sdf
python run.py -f res_store_logistics_offline_send_to_b2b

ps -ef|grep logistics_offline|grep python
ps -ef|grep logistics_offline|grep python|awk '{print $2}'|xargs kill -9

route_step = {
  "_id": "shopex_b2b_store.logistics.offline.send_taobao",
  "list": [
    {
      "vhost": "shopex_b2b",
      "key": "store_logistics_offline_send_to_sdf"
    },
    {
      "vhost": "taobao",
      "key": "taobao_logistics_offline_send_to_taobao"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_logistics_offline_send_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_logistics_offline_send_to_b2b"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

---------------------------------------------------------------------------------------------------------

[获取分销商信息]
route_key:shopex_b2b_store.fenxiao.distributors.get_taobao

0	shopex_b2b:		b2b_store_fenxiao_distributors_get_to_sdf
1	taobao:			taobao_fenxiao_distributors_get_to_taobao
2	spider:			request
3	taobao:			res_taobao_fenxiao_distributors_get_to_sdf
4	shopex_b2b:		res_b2b_store_fenxiao_distributors_get_to_b2b
5	spider:			request

ps -ef|grep fenxiao_distributors_get|grep python
ps -ef|grep fenxiao_distributors_get|grep python|awk '{print $2}'|xargs kill -9


route_step  ={
  "_id": "shopex_b2b_store.fenxiao.distributors.get_taobao",
  "list": [
    {
      "vhost": "shopex_b2b",
      "key": "b2b_store_fenxiao_distributors_get_to_sdf"
    },
    {
      "vhost": "taobao",
      "key": "taobao_fenxiao_distributors_get_to_taobao"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_fenxiao_distributors_get_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_b2b_store_fenxiao_distributors_get_to_b2b"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

---------------------------------------------------------------------------------------------------------


[确认收款]
route_key:shopex_b2b_store.fenxiao.order.confirm.paid_taobao

0	shopex_b2b:		store_fenxiao_order_confirm_paid_to_sdf
1	taobao:			taobao_fenxiao_order_confirm_paid_to_taobao
2	spider:			request
3	taobao:			res_taobao_fenxiao_order_confirm_paid_to_sdf
4	shopex_b2b:		res_store_fenxiao_order_confirm_paid_to_b2b
5	spider:			request

ps -ef|grep fenxiao_order_confirm_paid|grep python
ps -ef|grep fenxiao_order_confirm_paid|grep python|awk '{print $2}'|xargs kill -9

route_step = {
  "_id": "shopex_b2b_store.fenxiao.order.confirm.paid_taobao",
  "list": [
    {
      "vhost": "shopex_b2b",
      "key": "store_fenxiao_order_confirm_paid_to_sdf"
    },
    {
      "vhost": "taobao",
      "key": "taobao_fenxiao_order_confirm_paid_to_taobao"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_fenxiao_order_confirm_paid_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_fenxiao_order_confirm_paid_to_b2b"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

----------------------------------------------------------------------------------------------------------

[查询采购单信息]
route_key:shopex_b2b_store.fenxiao.orders.get_taobao

0.shopex_b2b:	store_fenxiao_orders_get_to_sdf
1.taobao:		taobao_fenxiao_orders_get_count_to_taobao
2.spider:		request
3.taobao:		res_taobao_fenxiao_orders_get_count_to_sdf
4.taobao:		taobao_fenxiao_orders_get_list_to_taobao
5.[spider_taobao_fenxiao_orders_list]
	0.spider:	request
	1.taobao:	res_taobao_fenxiao_orders_get_list_to_sdf
		[spider_taobao_fenxiao_order_to_presence]
			0.presence:		get_taobao_fenxiao_order_to_adapters
				[spider_fenxiao_order_distribute_to_shopex_b2b]
					0.shopex_b2b:	res_store_fenxiao_orders_get_to_b2b
					1.spider:		request
					#2.shopex_b2b:	res_store_fenxiao_orders_get_to_mongo

ps -ef|grep -E -i "fenxiao_order[s]?_(get)?"
ps -ef|grep -E -i "fenxiao_order[s]?_(get|to)"
ps -ef|grep -E -i "fenxiao_order[s]?_(get)?"|awk '{print $2}'|xargs kill -9

===========================================================================================================

[查询采购单信息 -- 改造]
route_key:taobao_fenxiao_order_count

0.spider:			request
1.complexlogic:		tb_fenxiao_order_count
2.[spider_taobao_fenxiao_order_list]
	0.spider:			request
	1.complexlogic:		tb_fenxiao_order_list
		[spider_fenxiao_order_distribute_to_shopex_b2b]
			0.shopex_b2b:	res_store_fenxiao_orders_get_to_b2b
			1.spider:		request
			#2.shopex_b2b:	res_store_fenxiao_orders_get_to_mongo

ps -ef|grep -E "(count|list)$"
ps -ef|grep -E "(count|list)$"|awk '{print $2}'|xargs kill -9

route_step_1 = {
  "_id": "taobao_fenxiao_order_count",
  "list": [
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "complexlogic",
      "key": "tb_fenxiao_order_count"
    }
  ]
}

route_step_2 = {
  "_id": "spider_taobao_fenxiao_order_list",
  "list": [
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "complexlogic",
      "key": "tb_fenxiao_order_list"
    }
  ]
}

route_step_3 = {
  "_id": "spider_fenxiao_order_distribute_to_shopex_b2b",
  "list": [
    {
      "vhost": "shopex_b2b",
      "key": "res_store_fenxiao_orders_get_to_b2b"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

===========================================================================================================

[获取单个用户信息]
ps -ef|grep -E "(taobao|store)_user_get" |grep python
ps -ef|grep -E "(taobao|store)_user_get" |grep python awk '{print $2}'|xargs kill -9

route_step = {
  "_id": "shopex_b2b_store.user.get_taobao",
  "list": [
    {
      "vhost": "shopex_b2b",
      "key": "b2b_store_user_get_to_sdf"
    },
    {
      "vhost": "taobao",
      "key": "taobao_user_get_to_taobao"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_user_get_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_b2b_store_user_get_to_b2b"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

===========================================================================================================

[创建店铺优惠券接口]
ps -ef|grep promotion_coupon_add|grep python
ps -ef|grep promotion_coupon_add|grep python|awk '{print $2}'|xargs kill -9

route_step = {
    "_id": "ecos.taocrm_store.promotion.coupon.add_taobao",
    "list": [
        {
          "vhost": "ecos.taocrm",
          "key": "store_promotion_coupon_add_to_sdf"
        },
        {
          "vhost": "taobao",
          "key": "taobao_promotion_coupon_add_to_taobao"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "taobao",
          "key": "res_taobao_promotion_coupon_add_to_sdf"
        },
        {
          "vhost": "ecos.taocrm",
          "key": "res_store_promotion_coupon_add_to_taocrm"
        },
        {
          "vhost": "spider",
          "key": "request"
        }
    ]
}

===========================================================================================================

[店铺优惠券发放接口]
ps -ef|grep promotion_coupon_send|grep python
ps -ef|grep promotion_coupon_send|grep python|awk '{print $2}'|xargs kill -9


route_step = {
    "_id": "ecos.taocrm_store.promotion.coupon.send_taobao",
    "list": [
        {
          "vhost": "ecos.taocrm",
          "key": "store_promotion_coupon_send_to_sdf"
        },
        {
          "vhost": "taobao",
          "key": "taobao_promotion_coupon_send_to_taobao"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "taobao",
          "key": "res_taobao_promotion_coupon_send_to_sdf"
        },
        {
          "vhost": "ecos.taocrm",
          "key": "res_store_promotion_coupon_send_to_taocrm"
        },
        {
          "vhost": "spider",
          "key": "request"
        }
    ]
}


===========================================================================================================

[通过接口可以查询某个店铺优惠券的买家详细信息]

ps -ef|grep promotion_coupondetail_get|grep python
ps -ef|grep promotion_coupondetail_get|grep python|awk '{print $2}'|xargs kill -9

route_step = {
    "_id": "ecos.taocrm_store.promotion.coupondetail.get_taobao",
    "list": [
        {
          "vhost": "ecos.taocrm",
          "key": "store_promotion_coupondetail_get_to_sdf"
        },
        {
          "vhost": "taobao",
          "key": "taobao_promotion_coupondetail_get_to_taobao"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "taobao",
          "key": "res_taobao_promotion_coupondetail_get_to_sdf"
        },
        {
          "vhost": "ecos.taocrm",
          "key": "res_store_promotion_coupondetail_get_to_taocrm"
        },
        {
          "vhost": "spider",
          "key": "request"
        }
    ]
}

===========================================================================================================

[查询物流宝订单]

ps -ef|grep promotion_coupondetail_get|grep python
ps -ef|grep promotion_coupondetail_get|grep python|awk '{print $2}'|xargs kill -9

route_step_1 = {
    "_id": "get_wlb_order_count",
    "list": [
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "complexlogic",
          "key": "wlb_order_count"
        }
    ]
}

route_step_2 = {
    "_id": "spider_wlb_order_list",
    "list": [
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "complexlogic",
          "key": "wlb_order_list"
        }
    ]
}

#############################################################################################
#获取运单号信息 @符号表示平等步骤
route_step_3@ = {
    "_id": "spider_get_wlb_tmsorder_logistic",
    "list": [
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "complexlogic",
          "key": "get_wlb_tmsorder_logistic"
        }
    ]
}
#############################################################################################

#此处detail是为了去查询发货单的流转状态,物流宝接口单独出来了
route_step_3 = {
    "_id": "spider_wlb_order_detail",
    "list": [
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "complexlogic",
          "key": "wlb_order_detail"
        }
    ]
}

#wlb_order_detail_distribute_to_%s(分发到各类型)
route_step_3_2 = {
    "_id": "wlb_order_detail_distribute_to_ecos_ome",
    "list": [
        {
          "vhost": "ecos.ome",
          "key": "wms_delivery_status_update_to_ome"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "ecos.ome",
          "key": "res_ome_wlb_order_statstics" 
        }
    ]
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#对于非发货单的 此处已经为订单详细,可以直接分发出去
#wlb_order_distribute_to_%s
route_step_3 = {
    "_id": "wlb_order_list_distribute_to_ecos_ome",
    "list": [
        {
          "vhost": "ecos.ome",
          "key": "ome_distribute_to_each_interface"
        }
    ]
}

#入库单
route_step_4 = {
    "_id": "notify_stockin_to_ome",
    "list": [
        {
          "vhost": "ecos.ome",
          "key": "wms_stockin_status_update_to_ome"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "ecos.ome",
          "key": "res_ome_wlb_order_statstics" 
        }
    ]
}

#退货单
route_step_4 = {
    "_id": "notify_reship_to_ome",
    "list": [
        {
          "vhost": "ecos.ome",
          "key": "wms_reship_status_update_to_ome"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "ecos.ome",
          "key": "res_ome_wlb_order_statstics" 
        }
    ]
}

#出库单
route_step_4 = {
    "_id": "notify_stockout_to_ome",
    "list": [
        {
          "vhost": "ecos.ome",
          "key": "wms_stockout_status_update_to_ome"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "ecos.ome",
          "key": "res_ome_wlb_order_statstics" 
        }
    ]
}

#发货单
route_step_4 = {
    "_id": "notify_delivery_to_ome",
    "list": [
        {
          "vhost": "ecos.ome",
          "key": "wms_delivery_status_update_to_ome"
        },
        {
          "vhost": "spider",
          "key": "request"
        },
        {
          "vhost": "ecos.ome",
          "key": "res_ome_wlb_order_statstics" 
        }
    ]
}

===========================================================================================================

[商品映射同步 store.wms.item.synchronize]

route_step = {
  "_id": "ecos.ome_store.wms.item.synchronize_wlb",
  "list": [
    {
      "vhost": "ecos.ome",
      "key": "store_wms_item_synchronize_to_sdf"
    },
    {
      "vhost": "wlb",
      "key": "taobao_wlb_item_synchronize_to_wlb"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_wlb_item_synchronize_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_wms_item_synchronize_to_ome"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

===========================================================================================================

[创建商品的代销关系 store.wms.item.consignment.create]

route_step = {
  "_id": "ecos.ome_store.wms.item.consignment.create_wlb",
  "list": [
    {
      "vhost": "ecos.ome",
      "key": "store_wms_item_consignment_create_to_sdf"
    },
    {
      "vhost": "wlb",
      "key": "taobao_wlb_item_consignment_create_to_wlb"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_wlb_item_consignment_create_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_wms_item_consignment_create_to_ome"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

===========================================================================================================

[添加商品授权规则 store.wms.item.authorization.add]

route_step = {
  "_id": "ecos.ome_store.wms.item.authorization.add_wlb",
  "list": [
    {
      "vhost": "ecos.ome",
      "key": "store_wms_item_authorization_add_to_sdf"
    },
    {
      "vhost": "wlb",
      "key": "taobao_wlb_item_authorization_add_to_wlb"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_taobao_wlb_item_authorization_add_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_wms_item_authorization_add_to_ome"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

===========================================================================================================

[企业物流库存变化通知 store.wms.enterprice.inventory.change.notify]

route_step = {
  "_id": "ecos.ome_store.wms.enterprice.inventory.change.notify_wlb",
  "list": [
    {
      "vhost": "ecos.ome",
      "key": "store_wms_enterprice_inventory_change_notify_to_sdf"
    },
    {
      "vhost": "wlb",
      "key": "wlb_enterprice_inventory_change_notify_to_wlb"
    },
    {
      "vhost": "spider",
      "key": "request"
    },
    {
      "vhost": "taobao",
      "key": "res_wlb_enterprice_inventory_change_notify_to_sdf"
    },
    {
      "vhost": "shopex_b2b",
      "key": "res_store_wms_enterprice_inventory_change_notify_to_ome"
    },
    {
      "vhost": "spider",
      "key": "request"
    }
  ]
}

===========================================================================================================

